package com.hxzy.tms.service;

import java.util.Date;
import java.util.List;
import java.util.Map;

import com.hxzy.tms.entity.Task;
import com.hxzy.tms.entity.UserTask;

public interface TaskService {
    ServiceResult<Task> read(long taskId);

    ServiceResult<Map<Integer, List<Task>>> list(long teamId, Long projectId);

    ServiceResult<Long> count(long teamId, Long projectId);

    ServiceResult<List<Task>> list(long teamId, Long projectId, int offset, int limit);

    ServiceResult<List<Task>> list(Long projectId, int offset, int limit);

    ServiceResult<List<UserTask>> list(long userId);

    ServiceResult<Task> create(long teamId, long projectId, String title, String desc, String attachmentUrl,
            Date gmtStart, Date gmtFinished);

    ServiceResult<Task> update(long taskId, String title, String desc, String attachmentUrl, Date gmtStart,
            Date gmtFinished);

    /**
     * 这个任务的所有成员完成任务情况
     * 
     * @param taskId
     * @return
     */
    ServiceResult<List<UserTask>> userTasks(long taskId);

    /**
     * 提交任务
     * 
     * @param taskId
     * @param attachmentUrl
     * @param remark
     * @return
     */
    ServiceResult<UserTask> commit(long taskId, String attachmentUrl, String remark);

    /**
     * 结束任务
     * 
     * @param userTaskId
     * @return
     */
    ServiceResult<UserTask> finish(long userTaskId);

}
